unit udmgeneral;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, BufDataset, FileUtil, ZConnection, ZDataset, udmbase;

type

  { TdmGeneral }

  TdmGeneral = class(TdmBase)
    ZConnection: TZConnection;
  private
    FDatabase: string;
    FPassword: string;
    FUsername: string;
    procedure SetDatabase(const AValue: string);
    procedure SetPassword(const AValue: string);
    procedure SetUsername(const AValue: string);
    { private declarations }
  public
    { public declarations }
    property Database: string read FDatabase write SetDatabase;
    property Username: string read FUsername write SetUsername;
    property Password: string read FPassword write SetPassword;

    function Connect: boolean;


  end; 

var
  dmGeneral: TdmGeneral;

implementation

{$R *.lfm}

{ TdmGeneral }

procedure TdmGeneral.SetDatabase(const AValue: string);
begin
  if FDatabase=AValue then exit;
  FDatabase:=AValue;
end;

procedure TdmGeneral.SetPassword(const AValue: string);
begin
  if FPassword=AValue then exit;
  FPassword:=AValue;
end;

procedure TdmGeneral.SetUsername(const AValue: string);
begin
  if FUsername=AValue then exit;
  FUsername:=AValue;
end;

function TdmGeneral.Connect: boolean;
begin
  with ZConnection do
  begin
    Database := self.Database;
    Username := self.Username;
    Password := self.Password;
    Connect;
    result := Connected;
  end;
end;




end.

